gdk/wayland: Clear modifiers when we lose keyboard focus
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Thu, 2 Apr 2020 17:31:22 +0000 (19:31 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 2 Apr 2020 20:18:18 +0000 (16:18 -0400)
commit7444b15d47e40d1c4696bf978319690db0b91c4b
tree680bc7690b44445dad1b7f4d701c0e50b9f46403
parentdd625abfc159cb2886ce497711c95a1e968383e4
gdk/wayland: Clear modifiers when we lose keyboard focus

When we `Alt+Tab` away from a GTK application, it loses keyboard focus.
If we don't clear the modifiers, events from other devices that we
receive while unfocused will assume `Alt` is still pressed. This results
in e.g. Firefox navigating through the history instead of scrolling the
page when using the mouse wheel on it.

We don't get any information about modifiers while we are missing
keyboard focus, so assuming no modifiers are active is the best we can
do.

The shell sends us a modifier update immediately before we regain
keyboard focus, so the state shouldn't get out of sync.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2112
gdk/wayland/gdkdevice-wayland.c